package com.apes.util;


import com.alibaba.fastjson.JSON;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import com.apes.scm.masterdata.frame.model.Branch;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能：树
 *
 * @author zhuyh
 * @time   14:21
 * @date   2018/8/7
 */
public class TreeUtilOne<T> {

    private String id;  //部门编码

    private String name; //部门名称

    private Branch parents;  //上级部门编码

    private int levels; //级别

    private boolean isLastStage = true;  //末级标记

    private String origin; //外部ID

    private boolean valid = true; //有效

    private Enumeration branchType; //部门类型（businessClass）（BC_purchase：采购; BC_sale：销售; BC_other：其他）

    private int version;

    private List<TreeUtilOne<T>> children=new ArrayList<TreeUtilOne<T>>();

    public TreeUtilOne(String id, String name, Branch parents, int levels, boolean isLastStage, String origin, boolean valid, Enumeration branchType,int version, List<TreeUtilOne<T>> children) {
        this.id = id;
        this.name = name;
        this.parents = parents;
        this.levels = levels;
        this.isLastStage = isLastStage;
        this.origin = origin;
        this.valid = valid;
        this.branchType = branchType;
        this.version = version;
        this.children = children;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Branch getParents() {
        return parents;
    }

    public void setParents(Branch parents) {
        this.parents = parents;
    }

    public int getLevels() {
        return levels;
    }

    public void setLevels(int levels) {
        this.levels = levels;
    }

    public boolean isLastStage() {
        return isLastStage;
    }

    public void setLastStage(boolean lastStage) {
        isLastStage = lastStage;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public boolean isValid() {
        return valid;
    }

    public void setValid(boolean valid) {
        this.valid = valid;
    }

    public Enumeration getBranchType() {
        return branchType;
    }
    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public void setBranchType(Enumeration branchType) {
        this.branchType = branchType;
    }

    public List<TreeUtilOne<T>> getChildren() {
        return children;
    }

    public void setChildren(List<TreeUtilOne<T>> children) {
        this.children = children;
    }


    public TreeUtilOne() {
        super();
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

}
